package form4;

import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;
import java.util.List;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import FMS.Form4;

import FMS.Form4_1;

public class ViewForm4_1 extends WebPage {
	
	public ViewForm4_1() throws IOException, SQLException {
		Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml");
		SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
		
		Form form = new Form("ViewForm4_1form");
		
        List<Form4> list = (List<Form4>)sqlMap.queryForList("Form4_1.getAll");
		
		ListView eachRecord = new ListView("eachRecord", list) {
			
		
			private static final long serialVersionUID = 1L;
			
			protected void populateItem(ListItem item) {
				final Form4_1 form4_1 = (Form4_1) item.getModelObject();
				item.add(new Label("orNod", form4_1.getOrNo()));
				item.add(new Label("particulars", form4_1.getParticulars()));
				item.add(new Label("amount", form4_1.getAmount()));
				item.add(new Label("dateDisbursed", form4_1.getDateDisbursed()));
				
				//item.add(new BookmarkablePageLink("view", Form4SubList.class));
				
			}
		};
		
		form.add(eachRecord);
		add(form);
		
	}
	
}
